package com.edu.exam.enums.assessment.generation;

import com.edu.exam.enums.core.BaseEnum;

/**
 * 任务类型枚举
 *
 * @author System
 * @version 1.0.0
 */
public enum JobType implements BaseEnum {
    PAPER_GENERATION("PAPER_GENERATION", "试卷生成"),
    QUESTION_GENERATION("QUESTION_GENERATION", "试题生成"),
    ANSWER_GENERATION("ANSWER_GENERATION", "答案生成"),
    SCHEME_GENERATION("SCHEME_GENERATION", "方案生成"),
    TEMPLATE_GENERATION("TEMPLATE_GENERATION", "模板生成"),
    BATCH_GENERATION("BATCH_GENERATION", "批量生成"),
    AUTO_GENERATION("AUTO_GENERATION", "自动生成"),
    MANUAL_GENERATION("MANUAL_GENERATION", "手动生成"),
    SCHEDULED_GENERATION("SCHEDULED_GENERATION", "定时生成"),
    CONDITIONAL_GENERATION("CONDITIONAL_GENERATION", "条件生成");

    private final String code;
    private final String description;

    JobType(String code, String description) {
        this.code = code;
        this.description = description;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getDescription() {
        return description;
    }

    public static JobType fromCode(String code) {
        for (JobType type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        throw new IllegalArgumentException("Unknown job type code: " + code);
    }

    @Override
    public String toString() {
        return code + " - " + description;
    }
}
